//
//  BaseNavigationController.m
//  oc_demo
//
//  Created by haigui on 2021/8/5.
//

#import "BaseNavigationController.h"

@interface BaseNavigationController ()<UINavigationControllerDelegate,UIGestureRecognizerDelegate>

@end

@implementation BaseNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.delegate = self;
    self.interactivePopGestureRecognizer.delegate = nil;
    [self.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#B3B3B3"]} forState:UIControlStateNormal];
    [self.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#60221C"]} forState:UIControlStateSelected];

    UIImage *navBarBackImg = [GlobalFile imageWithColor:[GlobalFile themeColor]];
    navBarBackImg = [navBarBackImg imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [self.navigationBar setBackgroundImage:navBarBackImg forBarMetrics:UIBarMetricsDefault];

    [self.navigationBar setBackIndicatorImage:[[UIImage imageNamed:@"common_back_white"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [self.navigationBar setBackIndicatorTransitionMaskImage:[[UIImage imageNamed:@"common_back_white"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    self.navigationBar.barStyle = UIBarStyleBlack;
    self.navigationBar.translucent = NO; //Bar的模糊效果，默认为NO
    self.navigationBar.shadowImage = [UIImage new];
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
    if (self.viewControllers.count>0) {
        viewController.hidesBottomBarWhenPushed = YES;
    }
    [super pushViewController:viewController animated:animated];
}

#pragma mark - --------------代理方法--------------
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
    
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
